package com.czbank.financing.service.impl;

import com.czbank.financing.Entity.Product;
import com.czbank.financing.Entity.UserInfo;
import com.czbank.financing.mapper.ProductMapper;
import com.czbank.financing.service.ProductService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @Auther: thinkpad
 * @Date: 2019/7/13 01:16
 * @Description:
 */
@Service
public class ProductServiceImpl implements ProductService {
    @Autowired
     private ProductMapper productMapper;
    @Override
    public Product SelectProductInfo(String productName) {
        return productMapper.findProductInfo(productName);
    }

    @Override
    public List<Product> TotalProduct() {
        System.out.println("productMapper.TotalProduct() = " + productMapper.TotalProduct());
        return productMapper.TotalProduct();
    }

    @Override
    public PageInfo<Product> selectAllProduct(Integer page, Integer size) {
        PageHelper.startPage(page, size);
        List<Product> productList = productMapper.TotalProduct();
        PageInfo<Product> pageInfo = new PageInfo<>(productList);

        return pageInfo;
    }

    @Override
    public int UpdateProductInfo(Product product) {
        return productMapper.UpdateProductInfo(product);
    }

    @Override
    public int InsertProductInfo(Product product) {
        return productMapper.InsertProductInfo(product);
    }

    @Override
    public int DeleteProductInfo(String productName) {
        return productMapper.DeleteProductInfo(productName);
    }


}
